#include"list.hpp"
void test2(const hcc::list<int>& d)
{
	hcc::list<int>::const_iterator it = d.begin();
	while (it != d.end())
	{
		cout << *it << "->";
		it++;
	}
	cout << endl;
	
}
void test1()
{
	hcc::list<int> l;
	l.push_back(1);
	l.push_back(2);
	l.push_back(3);
	l.push_back(4);
	l.push_back(5);
	test2(l);
}
void test3()
{
	class A
	{
	public:
		int a;
		int b;
		A()
			:a(1)
			,b(1)
		{}
	};
	A a;
	A b;
	A c;
	A d;
	hcc::list<A> l;
	l.push_back(a);
	l.push_back(b);
	l.push_back(c);
	l.push_back(d);
	auto it = l.begin();
	cout << (it->a) << endl;
	cout << (it->b) << endl;
}
void test4()
{
	hcc::list<int> l;
	l.push_front(1);
	l.push_front(2);
	l.push_front(3);
	l.push_front(4);
	l.push_front(5);
	l.push_front(6);
	l.pop_back();
	l.pop_back();
	l.pop_back();
	hcc::list<int>::iterator it = l.begin();
	while (it != l.end())
	{
		cout << *it << "->";
		it++;
	}
	cout << endl;
	l.pop_front();
	l.pop_front();
	it = l.begin();
	while (it != l.end())
	{
		cout << *it << "->";
		it++;
	}
	cout << endl;
}
void test5()
{
	hcc::list<int> l;

}
void test6()
{
	hcc::list<int> l;
	l.push_back(1);
	l.push_back(2);
	l.push_back(3);
	l.push_back(4);
	l.push_back(5);
	hcc::list<int>::iterator pos = ++l.begin();
	l.insert(pos, 30);
	l.push_back(300);
	for (auto e : l)
	{
		cout << e << "->";
	}
	cout << endl;
	l.erase(--l.end());
	for (auto s : l)
	{
		cout << s << "->";
	}
	cout << endl;
	l.pop_back();
	l.pop_back();
	l.pop_back();
	l.pop_back();
	for (auto d : l)
	{
		cout << d << "->";
	}
}
void test7()
{
	hcc::list<int> s1;
	s1.push_back(1);
	s1.push_back(2);
	s1.push_back(3);
	s1.push_back(4);
	s1.push_back(5);
	s1.push_back(6);
	cout << "s1:";
	for (auto d : s1)
	{
		cout << d << "->";
	}
	cout << endl;
	hcc::list<int> s2;
	s2.push_back(7);
	s2.push_back(8);
	s2.push_back(9);
	s2.push_back(10);
	s2.push_back(11);
	cout << "s2:";
	for (auto a : s2)
	{
		cout << a << "->";
	}
	cout << endl;
	s1.swap(s2);
	cout << "s1:";
	for (auto b : s1)
	{
		cout << b << "->";
	}
	cout << endl;
	cout << "s2:";
	for (auto c : s2)
	{
		cout <<  c << "->";
	}
}
void test(const hcc::list<int>& l)
{
	cout << l.back();
	for (auto e : l)
	{
		cout << e << "->";
	}
}
void test8()
{
	hcc::list<int> l;
	l.push_back(1);
	l.push_back(2);
	l.push_back(3);
	l.push_back(4);
	l.push_back(5);
	for (auto s : l)
	{
		cout << s << "->";
	}
	cout << endl;
	l.back() = 6;
	for (const auto& e : l)
	{
		cout << e << "->";
	}
	test(l);
}
void test9()
{
	hcc::list<int> l;
	l.push_back(1);
	l.push_back(2);
	l.push_back(3);
	l.push_back(4);
	const hcc::list<int>& s = l;
	const hcc::list<int>::const_iterator& cit = s.begin();
	//while (cit != s.end())
	//{
		cout << (*cit) << "->";
		//cit++;
	//}
	cout << endl;
}
void test10()
{
	hcc::list<int> l;
	l.push_back(1);
	l.push_back(2);
	l.push_back(3);
	l.push_back(4);
	l.push_back(5);
	l.clear();

}
void test11()
{
	hcc::list<int> l;
	l.push_back(1);
	l.push_back(2);
	l.push_back(3);
	l.push_back(4);
	l.push_back(5);
	for (const auto& e : l)
	{
		cout << e << "->";
	}
	cout << endl;
	hcc::list<int> s;
	s = l;
	for (const auto& e : s)
	{
		cout << e << "->";
	}
	cout << endl;
}
int main()
{
	//test1();
	//test3();
	//test4();
	//test5();
	//test6();
	//test7();
	//test8();
	//test9();
	//test10();
	test11();
	return 0;
}